home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7478 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: sage.cgd.ucar.edu!jadams
  2. From: jadams@sage.cgd.ucar.edu (James Adams)
  3. Newsgroups: comp.lang.c
  4. Subject: system() & error detection
  5. Date: 26 Feb 1996 19:36:48 GMT
  6. Organization: National Center for Atmospheric Research
  7. Distribution: world
  8. Message-ID: <4gt24g$dba@ncar.ucar.edu>
  9. Reply-To: jadams@sage.cgd.ucar.edu
  10. NNTP-Posting-Host: sage.cgd.ucar.edu
  11.  
  12. Hello,
  13.  
  14.         I am attempting to use the system() call in order to have a
  15. user-specified command execute in my program.
  16.  
  17.         I am wondering how I can check whether or not the command has
  18. completed successfully ?  I don't want the program to continue if the
  19. call I make from system() produces some sort of error.  I'd like to be
  20. able to do something like the following:
  21.  
  22.         result = system(command);
  23.         if (result == ERROR)
  24.           exit(0);
  25.  
  26. Is there anyway to do this ?  Should I be using something other than
  27. system() ?
  28.  
  29.  
  30.         Thanks for any suggestions !
  31.  
  32.  
  33. -James
  34. -- 
  35. ---------------------------------------------------------------------------
  36. James Adams                               Email: jadams@ucar.edu
  37. National Center for Atmospheric Research  Phone: (303) 497-1356
  38. Boulder, Colorado                         Fax:   (303) 497-1348
  39.  
  40.     WWW:  http://www.cgd.ucar.edu/ccr/jadams/home.html
  41.